import request from "../utils/request";
import {requestFilter} from "../utils/permiss";

export async function fetchPermission() {
    return await request.post('permission/menuPermissions')
}
// 获取登录验证码
export async function getLoginCode(params) {
    return await request.get('user/validateCode', {params: params, responseType: "arraybuffer"})
}
// 登录
export async function onLogin(params) {
    return await request.post('user/login', params)
}
//
export async function updatePassword(params) {
    return await request.post('system/updatePassword', params)
}

// 获取商户下拉列表
export async function selectMerchant(params) {
    if (requestFilter('merchant/merchantListDropDown')) {
        const res = await request.post('merchant/merchantListDropDown', params)
        return res.code === 200 ? res.data : []
    } else {
        return []
    }
}

// 首页资金统计
export async function fetchHomeMoney(params = {}) {
    return await request.post('home/fundStatistics', params)
}

// 今日数据统计
export async function fetchHomeTodayMoney(params = {}) {
    return await request.post('home/todayStatistics', params)
}

// 未指定商户列表
export async function fetchCollectionUnknown(params = {}) {
    return await request.post('collectionUnknown/list', params)
}

// 未指定商户导出
export async function collectionUnknownExport(params = {}) {
    return await request.post('collectionUnknown/export', params)
}

// 切换指定商户
export async function changeCollectionUnknown(params = {}) {
    return await request.post('collectionUnknown/appointMerchant', params)
}
